$(document).ready(function() {
	
	$("#selectall").click(function() {
        if ($("#selectall").prop("checked") == true) {
            $(".chek_all").prop("checked", true);
        } else {
            $(".chek_all").prop("checked", false);
        }
    });
	
	$(".form_datetime").datepicker({
		format: 'yyyy-mm-dd'
	});
	
	$("#inv_main_status").select2({
       placeholder: "Select Invoice Status",
	   width: '100%'
    });
	
	$("#inv_deal_id").select2({
       placeholder: "Select Deal",
	   width: '100%'
    });
	
	$("#inv_quote_id").select2({
       placeholder: "Select Quote",
	   width: '100%'
    });
	
	$("#inv_contractor_id").select2({
       placeholder: "Select Contractor",
	   width: '100%'
    });
	
	$('.company_client').change(function() {
        var postdata = {};
        var inv_contractor_type = $(this).val();
        if (inv_contractor_type === '') {
        } else {
            postdata['inv_contractor_type'] = inv_contractor_type;
            jQuery.post(ADMIN_URL + 'invoice/getcontractorlist', postdata, function(result) {
               $('#inv_contractor_id').html(result);
            });
        }
    });

});